<template>
  <div class="dynamic_form_item">
      <a-form-item :name="props.question.key">
        <template v-slot:label>
          <label for="">{{ props.question.label }}</label>
        </template>
        <CustEditor v-model:value="props.question.value" :initData="props.question.state.initData" @change="change"></CustEditor>
      </a-form-item>
  </div>
</template>
<script setup lang="ts">
import { watch,onMounted, reactive} from "vue";
import { QuestionBase } from "../../../question-base";
import CustEditor from '../../../../ckeditor/ckeditor.component.vue';

//subject变量

let props = defineProps<{ question: QuestionBase<any>,formData:any}>();
const emit = defineEmits([ "update:formData"]);
watch(()=>props.question.value, (val)=>{
    emit('update:formData', val);
},{ flush:'post' });

onMounted(() => {
})

const change = (val:any)=>{
  props.question.value = val;
}

</script>

<style lang="less" scoped>
@import url('./input-ckeditor.component.less');
</style>
